package com.app.service.impl;

import com.app.mapper.ShareCircleMapper;
import com.app.mapper.ShareLikesComMapper;
import com.app.model.CusWorkExperienceModel;
import com.app.model.ShareCircleModel;
import com.app.model.ShareLikesComModel;
import com.app.model.UserModel;
import com.app.service.ShareCircleService;
import com.app.service.ShareLikesComService;
import com.app.service.UserService;
import com.app.util.CommonHelp;
import com.app.util.Result;
import com.app.util.TokenUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;


/**
 * @Description:行业
 * @Author: N
 * @Date: 2022年11月24日 10点29分
 */
@Service
@Log4j2
public class ShareCircleServiceImpl implements ShareCircleService {
    @Autowired
    ShareCircleMapper shareCircleMapper;

    @Override
    public int insert(ShareCircleModel model) {

        return shareCircleMapper.insert(model);
    }

    @Override
    public int delete(int id) {
        return shareCircleMapper.deleteById(id);
    }

    @Override
    public List<ShareCircleModel> selectCircleByUid(int uid) {
        QueryWrapper<ShareCircleModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("id","content","crt_time").eq("user_id", uid).orderByAsc("crt_time");
        List<ShareCircleModel> userList = shareCircleMapper.selectList(queryWrapper);
        if (userList.size() <= 0) {
            return null;
        } else {
            return userList;
        }
    }


}
